package com.ams.thread.lesson1;

import cn.hutool.core.thread.ThreadUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @author： 乐哥聊编程(全平台同号)
 */
@Slf4j
public class Example6 {

    public static void main(String[] args) {
        log.info(Thread.currentThread().getName());
        log.info(Thread.currentThread().isDaemon()?"daemon线程":"非daemon线程");
        Thread thread = new Thread(new DaemonThread());
        thread.setDaemon(true);
//        thread.start();

    }

    static class DaemonThread implements Runnable {
        @Override
        public void run() {
            ThreadUtil.sleep(3, TimeUnit.SECONDS);
            System.out.printf("daemon 运行结束");
        }
    }
}
